package com.easy.project.util;

import cn.hutool.core.lang.UUID;

/**
 * 文件工具类
 */
public class FileUtils {

    /**
     * 改变文件名
     * @param fileName
     * @return
     */
    public static String changeFileName(String fileName){
        String onlyFileName;
        String uuid = UUID.fastUUID().toString();
        String[] split = fileName.split("\\.");
        if (split.length > 1) {
            onlyFileName = split[0] + "_" + uuid + "." + split[1];
        } else {
            onlyFileName = fileName + uuid;
        }
        return onlyFileName;
    }
}
